<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/6
 * Time: 20:55
 */


require_once "../config/config.php";
require_once "../model/adminDb.php";

$adminDb = new adminDb();
$data = $_POST['data'];
$id = $_POST['id'];
$name = $data['name'];
$password = $data['password'];
$card = $data['card'];
$desc=$data['desc'];
$password=md5($password);
$addtime=time();
$updateData=$adminDb->updataUser($id,$name,$password,$card,$desc,$addtime);
try {
    if ($updateData) {
        $dat = array(
            'msg' => "编辑成功",
            "code" => 200,

        );
        echo json_encode($dat);
    } else {
        $dat = array(
            "code" => 404,
            'msg' => "编辑失败",

        );
        echo json_encode($dat);

    }
} catch (Exception $e) {
    // 回滚事务
    // $pdo->rollback();
    echo $e->getMessage();
}













